home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / TRTEST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  2.2 KB  |  52 lines

  1. // trtest.cpp: Test programd to demonstrate clipping abilities of Trso's
  2.  
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <dos.h>
  6. #include "trsounit.h"
  7. #include "keybrd.h"
  8.  
  9. main()
  10. {
  11.   // ------------------------- Part 1 ------------------------ 
  12.   // Create a screen buffer, clear the screen, and draw a box. 
  13.   // ---------------------------------------------------------
  14.   TxBuff ScrnBuff(VideoPtr()); 
  15.   ScrnBuff.SetSize(80,25);
  16.   Trso Screen(&ScrnBuff);  // Create a Trso, aliased to the screen 
  17.   Screen.SetSize(80, 25);  // Default locn is (0,0)
  18.   // Clear the screen with a fill pattern
  19.   Screen.Fill(0, 0, Screen.Wd, Screen.Ht, 176, 0x07);
  20.   // Draw a reverse video, single line box in the middle of it
  21.   Screen.Box(30, 8, 15, 5, 0x11, 0x70);
  22.   // ------------------------- Part 2 ------------------------
  23.   // Create a small window, alias it to the screen. Blank
  24.   // out the window, and clip some text on it.
  25.   // ---------------------------------------------------------
  26.   Trso Window(&ScrnBuff);
  27.   Window.SetLocn(31, 9); // Place and size our window */
  28.   Window.SetSize(13, 3); // to be inside our box 
  29.   // Blank out the window 
  30.   Window.Fill(0, 0, Window.Wd, Window.Ht, ' ', 0x07);
  31.   // Here's an example of left- and right-hand clipping
  32.   Window.HzWrt(-10, 1, "Hey, you: press any key now", 0x07);
  33.   bioskey(0);
  34.   // ------------------------- Part 3 ------------------------
  35.   // Now, erase the box and window, and resize and reposition
  36.   // the box and window, and show clipping of some boxes
  37.   // inside the window.
  38.   // ---------------------------------------------------------
  39.   Screen.Fill(0, 0, Screen.Wd, Screen.Ht, 176, 0x07);
  40.   Screen.Box(20, 4, 42, 17, 0x11, 0x70);
  41.   Window.SetLocn(21, 5);
  42.   Window.SetSize(40, 15);
  43.   Window.Box(35, 5,  15, 4, 0x11, 0x07); // Clip to right
  44.   Window.Box(27, -2, 15, 4, 0x11, 0x07); // Clip to top-right
  45.   Window.Box(-5, -3, 15, 4, 0x11, 0x07); // Clip to top-left
  46.   Window.Box(-5, 5,  15, 4, 0x11, 0x07); // Clip to left
  47.   Window.Box(-2, 13, 15, 4, 0x11, 0x07); // Clip to bottom-left
  48.   Window.Box(35, 13, 15, 4, 0x11, 0x07); // Clip to bottom-right
  49.   // All the screen object destructors called automatically
  50. }
  51.  
  52.